const router = require("express").Router();
const db = require("../config/db");

// 添加学生信息接口
router.post("/addpropertymsg", (req, res) => {
  // console.log(req.body);
  let { department, quantity, type, balance, date } = req.body;
  // console.log(department, quantity, type, balance, date);
  data = [department, quantity, type, balance, date];
  // console.log(data);
  let sql = `insert into property(department, quantity, type, balance, date) values (?,?,?,?,?)`;

  if (
    department != "" ||
    quantity != "" ||
    type != "" ||
    balance != "" ||
    date != ""
  ) {
    db.query(sql, data, (err, results) => {
      res.send({
        msg: "成功",
        code: 200,
      });
    });
  }
});
module.exports = router;
